﻿using System;

public class Solution
{
    public bool IsToeplitzMatrix(int[,] matrix)
    {
        int rows = matrix.GetLength(0);
        int cols = matrix.GetLength(1);

        for (int i = 1; i < rows; i++)
        {
            for (int j = 1; j < cols; j++)
            {
                if (matrix[i, j] != matrix[i - 1, j - 1])
                {
                    return false;
                }
            }
        }
        return true;
    }
}

public class Program
{
    public static void Main()
    {
        Solution solution = new Solution();

        // 示例测试矩阵
        int[,] testMatrix = new int[,] {
            {1, 2, 3, 4},
            {5, 1, 2, 3},
            {9, 5, 1, 2}
        };

        bool result = solution.IsToeplitzMatrix(testMatrix);
        Console.WriteLine("Is Toeplitz Matrix? " + result); // 输出 True
    }
}